public class LabelCommand
extends java.lang.Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
LabelCommand.BARCODETYPE
条码类型枚举
|
static class |
LabelCommand.BITMAP_MODE
图片模式枚举
|
static class |
LabelCommand.CODEPAGE
代码页枚举
|
static class |
LabelCommand.DENSITY
打印浓度枚举
|
static class |
LabelCommand.DIRECTION
打印方向枚举
|
static class |
LabelCommand.EEC
二维码纠错等级枚举
|
static class |
LabelCommand.FONTMUL
字体放大倍数枚举
|
static class |
LabelCommand.FONTTYPE
字体类型枚举
|
static class |
LabelCommand.FOOT |
static class |
LabelCommand.MIRROR
镜像枚举
|
static class |
LabelCommand.READABEL |
static class |
LabelCommand.RESPONSE_MODE
响应模式枚举
|
static class |
LabelCommand.ROTATION
旋转方向枚举
|
static class |
LabelCommand.Shape
矩阵二维码图像类型枚举
|
static class |
LabelCommand.SPEED
速度枚举
|
| 限定符和类型 | 字段和说明 |
|---|---|
(专用程序包) java.util.Vector<java.lang.Byte> |
Command |
| 构造器和说明 |
|---|
LabelCommand()
实例化对象
|
LabelCommand(int width,
int height,
int gap)
构造函数说明:初始化标签,设置标签尺寸 单位 mm
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add1DBarcode(int x,
int y,
LabelCommand.BARCODETYPE type,
int height,
LabelCommand.READABEL readable,
LabelCommand.ROTATION rotation,
int narrow,
int width,
java.lang.String content)
方法说明:在标签上绘制一维条码
|
void |
add1DBarcode(int x,
int y,
LabelCommand.BARCODETYPE type,
int height,
LabelCommand.READABEL readable,
LabelCommand.ROTATION rotation,
java.lang.String content)
方法说明:在标签上绘制一维条码
|
void |
addBackFeed(int dot)
方法说明:退纸 单位为dot 1mm为8dot
|
void |
addBar(int x,
int y,
int width,
int height)
方法说明:在标签上画线
|
void |
addBitmap(int x,
int y,
int nWidth,
Bitmap bmp)
方法说明:在标签上绘制图片
|
void |
addBitmap(int x,
int y,
LabelCommand.BITMAP_MODE mode,
int nWidth,
Bitmap b)
方法说明:在标签上绘制图片
|
void |
addBitmapByMethod(int x,
int y,
LabelCommand.BITMAP_MODE mode,
int nWidth,
Bitmap b)
方法说明:在标签上绘制图片 抖动图片算法
|
void |
addBitmapNew(Bitmap bitmap,
int x,
int y)
方法说明:在标签上绘制图片 新增图片算法(效果会好一点)
|
void |
addBline(int Bline)
方法说明:设置标签黑标尺寸 单位mm
|
void |
addBox(int x,
int y,
int xend,
int yend,
int thickness)
方法说明:在标签上绘制黑块
|
void |
addCashdrwer(LabelCommand.FOOT m,
int t1,
int t2)
方法说明:打开钱箱命令
|
void |
addCls()
方法说明:清除打印缓冲区
|
void |
addCodePage(LabelCommand.CODEPAGE page)
方法说明:设置国际代码页
|
void |
addCutter(LabelCommand.RESPONSE_MODE enable)
方法说明:设置切刀是否有效
|
void |
addCutterBatch()
打印到最后一张切纸
|
void |
addCutterPieces(short number)
设置打印几张后切纸,如果调用addPrint的打印份数小于number,则不会进行切纸
|
void |
addDensity(LabelCommand.DENSITY density)
方法说明:设置打印浓度
|
void |
addDirection(LabelCommand.DIRECTION direction,
LabelCommand.MIRROR mirror)
方法说明:设置打印方向
|
void |
addDMATRIX(int x,
int y,
int width,
int height,
int xZoom,
int row,
int col,
java.lang.String content)
矩阵二维码
|
void |
addDMATRIX(int x,
int y,
int width,
int height,
int c,
int xZoom,
LabelCommand.ROTATION rotation,
LabelCommand.Shape shape,
int row,
int col,
java.lang.String content)
矩阵二维码
|
void |
addDMATRIX(int x,
int y,
int width,
int height,
int c,
int xZoom,
java.lang.String content)
矩阵二维码
|
void |
addDMATRIX(int x,
int y,
int width,
int height,
int xZoom,
java.lang.String content)
矩阵二维码
|
void |
addDMATRIX(int x,
int y,
int width,
int height,
LabelCommand.ROTATION rotation,
java.lang.String content)
矩阵二维码
|
void |
addDMATRIX(int x,
int y,
int width,
int height,
java.lang.String content)
矩阵二维码
|
void |
addErase(int x,
int y,
int xwidth,
int yheight)
方法说明:该指令用于清除影像缓冲区部份区域的数据
|
void |
addFeed(int dot)
方法说明:进纸 单位为dot 1mm为8dot
|
void |
addFormFeed()
方法说明:走一张标签
|
void |
addGap(int gap)
方法说明:设置标签间隙尺寸 单位mm
|
void |
addHome()
方法说明:校准标签纸
|
void |
addLimitFeed(int n)
方法说明 :该指令用于设定打印机进纸时,若经过所设定的长度仍无法侦测到垂直间距, 则打印机发生错误,停止进纸
|
void |
addNewBitmap(int x,
int y,
int nWidth,
Bitmap b,
int level)
压缩图片算法 (部分机器可用)不支持,打印空白或不打印
|
void |
addOffset(int offset)
方法说明:设置剥离模式下标签停止的位置 单位mm
|
void |
addPartialCutter(LabelCommand.RESPONSE_MODE enable)
方法说明:设置切刀半切是否有效
|
void |
addPeel(LabelCommand.RESPONSE_MODE enable)
方法说明:设置打印机剥离模式
|
void |
addPrint(int m)
方法说明:执行打印份数
|
void |
addPrint(int m,
int n)
方法说明:执行打印
|
void |
addPrintKey(int m)
方法说明:设置按键打印份数
|
void |
addPrintKey(LabelCommand.RESPONSE_MODE enable)
方法说明:设置是否按键打印有效
|
void |
addQRCode(int x,
int y,
LabelCommand.EEC level,
int cellwidth,
LabelCommand.ROTATION rotation,
java.lang.String data)
打印二维码
|
void |
addQueryPrinterCodePage()
方法说明:查询打印机代码页
|
void |
addQueryPrinterFile()
方法说明:查询打印机存储文档
|
void |
addQueryPrinterLife()
方法说明:查询打印机已打印里程
|
void |
addQueryPrinterMemory()
方法说明:查询打印机内存
|
void |
addQueryPrinterStatus()
方法说明:查询打印机实时状态
|
void |
addQueryPrinterStatus(LabelCommand.RESPONSE_MODE mode)
此方法一般在一张订单的最后加入, 打印机打印完成时, 会接收到一条GpCom.ACTION_DEVICE_STATUS广播,
可以在此广播里发送下一条订单给打印机
RESPONSE_MODE.ON 打开自动返回状态功能,每打印一张返回一次
RESPONSE_MODE.OFF 关闭自动返回状态功能
RESPONSE_MODE.BATCH 打开自动返回状态功能,打印完毕后返回一次
|
void |
addQueryPrinterType()
方法说明 :查询打印机型号
|
void |
addReference(int x,
int y)
方法说明:设置标签原点坐标
|
void |
addReprint(LabelCommand.RESPONSE_MODE enable)
方法说明:设置出现错误时是否打印上一张内容
|
void |
addResetPrinter()
方法说明:打印机复位
|
void |
addReverse(int x,
int y,
int xwidth,
int yheight)
方法说明:该指令用于清除影像缓冲区部份区域的数据
|
void |
addSelfTest()
方法说明:打印自检页
|
void |
addShif(int shift)
方法说明:设置标签偏移距离 单位mm
|
void |
addSize(int width,
int height)
方法说明:设置标签尺寸的宽和高 单位 mm
|
void |
addSound(int level,
int interval)
方法说明:设置蜂鸣器
|
void |
addSpeed(LabelCommand.SPEED speed)
方法说明:设置打印速度
|
void |
addTear(LabelCommand.RESPONSE_MODE enable)
方法说明:设置打印机撕离模式
|
void |
addText(int x,
int y,
LabelCommand.FONTTYPE font,
LabelCommand.ROTATION rotation,
LabelCommand.FONTMUL Xscal,
LabelCommand.FONTMUL Yscal,
java.lang.String text)
方法说明:在标签上绘制文字
|
void |
addUnicodeText(int x,
int y,
LabelCommand.FONTTYPE font,
LabelCommand.ROTATION rotation,
LabelCommand.FONTMUL Xscal,
LabelCommand.FONTMUL Yscal,
java.lang.String text,
java.lang.String textType)
打印其他编码语言
|
void |
addUserCommand(byte[] command)
增加用户自定义指令
|
void |
addUserCommand(java.lang.String command)
增加用户自定义指令
|
void |
addZLibBitmap(int x,
int y,
int nWidth,
Bitmap bitmap)
压缩图片算法 (部分机器可用)不支持,打印空白或不打印
|
void |
addZLibNoTrembleBitmap(int x,
int y,
int nWidth,
Bitmap bitmap)
图片压缩算法
|
void |
addZLibNoTrembleBitmapheight(int x,
int y,
int nWidth,
Bitmap bitmap)
已分割压缩图片算法,打印挽联可用 (部分机器可用)不支持,打印空白或不打印
|
void |
clrCommand()
方法说明:清除命令缓冲区
|
static Bitmap |
cutBitmap(Bitmap bitmap,
int y,
int height)
切割图片
|
java.util.Vector<java.lang.Byte> |
getCommand()
方法说明:获得打印命令
|
int |
getCommandLength()
方法说明:返回集合的长度
|
byte[] |
getZLibData(int w,
int nWidth,
Bitmap bitmap)
获取压缩图片数据
|
static java.util.List<Bitmap> |
ImageCrop(Bitmap bitmap,
int photoheight)
切割图片
|
public LabelCommand()
public LabelCommand(int width,
int height,
int gap)
width - 标签宽度height - 标签高度gap - 标签间隙public void clrCommand()
public int getCommandLength()
public void addGap(int gap)
gap - 间隙长度public void addBline(int Bline)
Bline - 黑标高度public void addSize(int width,
int height)
width - 标签宽度height - 标签高度public void addCashdrwer(LabelCommand.FOOT m, int t1, int t2)
m - 钱箱号t1 - 高电平时间t2 - 低电平时间public void addOffset(int offset)
offset - 偏移量public void addSpeed(LabelCommand.SPEED speed)
speed - 打印速度public void addDensity(LabelCommand.DENSITY density)
density - 浓度public void addDirection(LabelCommand.DIRECTION direction, LabelCommand.MIRROR mirror)
direction - 方向public void addReference(int x,
int y)
x - 横坐标y - 纵坐标public void addShif(int shift)
shift - 偏移量public void addCls()
public void addFeed(int dot)
dot - 进制距离public void addBackFeed(int dot)
dot - 退纸距离public void addFormFeed()
public void addHome()
public void addPrint(int m,
int n)
m - n - public void addPrint(int m)
m - 份数public void addCodePage(LabelCommand.CODEPAGE page)
page - 代码页号码,详见枚举方法public void addSound(int level,
int interval)
level - 频率interval - 时间public void addLimitFeed(int n)
n - 单位为dotpublic void addSelfTest()
public void addBar(int x,
int y,
int width,
int height)
x - 横坐标y - 纵坐标width - 线宽height - 线高public void addText(int x,
int y,
LabelCommand.FONTTYPE font,
LabelCommand.ROTATION rotation,
LabelCommand.FONTMUL Xscal,
LabelCommand.FONTMUL Yscal,
java.lang.String text)
x - 横坐标y - 纵坐标font - 字体类型rotation - 旋转角度Xscal - 横向放大Yscal - 纵向放大text - 文字字符串public void addUnicodeText(int x,
int y,
LabelCommand.FONTTYPE font,
LabelCommand.ROTATION rotation,
LabelCommand.FONTMUL Xscal,
LabelCommand.FONTMUL Yscal,
java.lang.String text,
java.lang.String textType)
x - y - font - rotation - Xscal - Yscal - text - textType - public void add1DBarcode(int x,
int y,
LabelCommand.BARCODETYPE type,
int height,
LabelCommand.READABEL readable,
LabelCommand.ROTATION rotation,
java.lang.String content)
x - 横坐标y - 纵坐标type - 条码类型height - 条码高度readable - 是否可识别rotation - 旋转角度content - 条码内容public void add1DBarcode(int x,
int y,
LabelCommand.BARCODETYPE type,
int height,
LabelCommand.READABEL readable,
LabelCommand.ROTATION rotation,
int narrow,
int width,
java.lang.String content)
x - 横坐标y - 纵坐标type - 条码类型height - 条码高度readable - 是否可识别rotation - 旋转角度content - 条码内容public void addBox(int x,
int y,
int xend,
int yend,
int thickness)
x - 起始横坐标y - 起始横坐标xend - 终点横坐标yend - 终点纵坐标public void addBitmap(int x,
int y,
LabelCommand.BITMAP_MODE mode,
int nWidth,
Bitmap b)
x - 打印起始点横坐标y - 打印起始点纵坐标mode - 打印模式nWidth - 打印在标签上图片的宽度 传入参数为点数,
200dpi打印机 1mm=8dot
300dpi打印机 1mm=12dot
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*8=160
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*12=240b - 单色位图public void addBitmapByMethod(int x,
int y,
LabelCommand.BITMAP_MODE mode,
int nWidth,
Bitmap b)
x - 打印起始点横坐标y - 打印起始点纵坐标mode - 打印模式nWidth - 打印在标签上图片的宽度 传入参数为点数,
200dpi打印机 1mm=8dot
300dpi打印机 1mm=12dot
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*8=160
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*12=240b - 单色位图public void addBitmap(int x,
int y,
int nWidth,
Bitmap bmp)
x - 打印起始点横坐标y - 打印起始点纵坐标nWidth - 打印在标签上图片的宽度 传入参数为点数,
200dpi打印机 1mm=8dot
300dpi打印机 1mm=12dot
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*8=160
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*12=240bmp - 单色位图public void addBitmapNew(Bitmap bitmap,
int x,
int y)
bitmap - 单色位图x - 打印起始点横坐标y - 打印起始点纵坐标public void addZLibBitmap(int x,
int y,
int nWidth,
Bitmap bitmap)
x - 打印起始点横坐标y - 打印起始点纵坐标nWidth - 打印在标签上图片的宽度 传入参数为点数,
200dpi打印机 1mm=8dot
300dpi打印机 1mm=12dot
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*8=160
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*12=240bitmap - public void addNewBitmap(int x,
int y,
int nWidth,
Bitmap b,
int level)
x - 打印起始点横坐标y - 打印起始点纵坐标nWidth - 打印在标签上图片的宽度 传入参数为点数,
200dpi打印机 1mm=8dot
300dpi打印机 1mm=12dot
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*8=160
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*12=240bitmap - level - 压缩水平public void addZLibNoTrembleBitmapheight(int x,
int y,
int nWidth,
Bitmap bitmap)
x - 打印起始点横坐标y - 打印起始点纵坐标nWidth - 打印在标签上图片的宽度 传入参数为点数,
200dpi打印机 1mm=8dot
300dpi打印机 1mm=12dot
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*8=160
若打印图片在200dpi打印机上,需要打印的宽度为20mm 即传入该参数为20*12=240bitmap - public static Bitmap cutBitmap(Bitmap bitmap,
int y,
int height)
bitmap - 原图y - 图片Y轴坐标height - 图片截取高度public static java.util.List<Bitmap> ImageCrop(Bitmap bitmap,
int photoheight)
bitmap - photoheight - public void addZLibNoTrembleBitmap(int x,
int y,
int nWidth,
Bitmap bitmap)
x - y - nWidth - bitmap - public byte[] getZLibData(int w,
int nWidth,
Bitmap bitmap)
w - nWidth - bitmap - public void addErase(int x,
int y,
int xwidth,
int yheight)
x - 起始横坐标y - 起始横坐标xwidth - 终点横坐标yheight - 终点纵坐标public void addReverse(int x,
int y,
int xwidth,
int yheight)
x - 起始横坐标y - 起始横坐标xwidth - 终点横坐标yheight - 终点纵坐标public void addQRCode(int x,
int y,
LabelCommand.EEC level,
int cellwidth,
LabelCommand.ROTATION rotation,
java.lang.String data)
x - y - level - cellwidth - rotation - data - public java.util.Vector<java.lang.Byte> getCommand()
public void addQueryPrinterType()
public void addQueryPrinterStatus()
public void addResetPrinter()
public void addQueryPrinterLife()
public void addQueryPrinterMemory()
public void addQueryPrinterFile()
public void addQueryPrinterCodePage()
public void addPeel(LabelCommand.RESPONSE_MODE enable)
enable - 是否开启public void addTear(LabelCommand.RESPONSE_MODE enable)
enable - 是否开启public void addCutter(LabelCommand.RESPONSE_MODE enable)
enable - 是否开启public void addCutterBatch()
public void addCutterPieces(short number)
number - 打印几张纸后切纸 0 <= number <= 65535public void addReprint(LabelCommand.RESPONSE_MODE enable)
enable - 是否开启public void addPrintKey(LabelCommand.RESPONSE_MODE enable)
enable - 是否开启public void addPrintKey(int m)
m - 是否开启public void addPartialCutter(LabelCommand.RESPONSE_MODE enable)
enable - 是否开启public void addQueryPrinterStatus(LabelCommand.RESPONSE_MODE mode)
public void addDMATRIX(int x,
int y,
int width,
int height,
java.lang.String content)
x - y - width - height - content - 内容public void addDMATRIX(int x,
int y,
int width,
int height,
LabelCommand.ROTATION rotation,
java.lang.String content)
x - y - width - height - rotation - 旋转content - 内容public void addDMATRIX(int x,
int y,
int width,
int height,
int xZoom,
java.lang.String content)
x - y - width - height - xZoom - X 轴放大倍数content - 内容public void addDMATRIX(int x,
int y,
int width,
int height,
int c,
int xZoom,
java.lang.String content)
x - y - width - height - xZoom - X 轴放大倍数content - 内容public void addDMATRIX(int x,
int y,
int width,
int height,
int xZoom,
int row,
int col,
java.lang.String content)
x - y - width - height - xZoom - X 轴放大倍数content - 内容public void addDMATRIX(int x,
int y,
int width,
int height,
int c,
int xZoom,
LabelCommand.ROTATION rotation,
LabelCommand.Shape shape,
int row,
int col,
java.lang.String content)
x - y - width - height - xZoom - X 轴放大倍数content - 内容public void addUserCommand(java.lang.String command)
command - 传入String类型public void addUserCommand(byte[] command)
command - 传入byte数组